package me.zhengjie.modules.poker;

public class Card implements Comparable<Card> {
    private final Rank rank;
    private final Suit suit;

    public Card(Rank rank, Suit suit) {
        this.rank = rank;
        this.suit = suit;
    }

    public Rank getRank() {
        return rank;
    }

    public Suit getSuit() {
        return suit;
    }

    @Override
    public int compareTo(Card other) {
        return Integer.compare(this.rank.getValue(), other.rank.getValue());
    }

    public static Card fromStrings(String rankStr, String suitStr) {
        return new Card(Rank.fromString(rankStr), Suit.fromString(suitStr));
    }

    @Override
    public String toString() {
        return rank.toString() + suit.toString();
    }
}